<template>
 <div class="credit">

    <credit-old v-if="projectKey == 'old'" :projectId="projectId" :taskId="taskId" :operationLook="operationLook"></credit-old>
    <credit-new v-if="projectKey == 'new'" :projectId="projectId" :taskId="taskId" :operationLook="operationLook"></credit-new>
   
  </div>
</template>


<script>
import ProjectApprovalHistory from '@/views/task/task_detail/project_approval_history';
import CreditOld from "@/views/task/task_detail/creditOld";
import CreditNew from "@/views/task/task_detail/creditNew";
import { findByProjectId,addCredit } from '@/api/credit'
import {findProjectBytId} from '@/api/project';
import {getProjectKey} from "@/utils/index";
export default {
  name: 'add',
  components: {
     ProjectApprovalHistory,
     CreditNew,
     CreditOld
     },
    props:{
      projectId: undefined,
      taskId: undefined,
      operationLook: undefined
    },
  data() {
    return {
      activeIndex: '1',
      name: "11",
      projectKey:undefined
    }
  },
  computed: {
   
  },
  created() {
    // console.log(this.taskId)
    this.findByProjectId()
  },
  methods: {
    findByProjectId() {
      findProjectBytId({projectId:this.projectId})
        .then(response => {
          if(response.data != undefined ) {
           console.log(response.data)
           let key = getProjectKey(response.data.processKey)
           this.projectKey = key
          }
        })
        .catch(() => {
        })
    },
    //  targetUrl(url){
    //    window.open(url)
    // },
    // stepChange(currentStep){
    //     this.currentStep = currentStep;
    // },
    // handleSelect(val){
    //   this.activeIndex = val
    // },
    //   createData(){

    //     addCredit(this.formData3.powerAttrList)
    //         .then(response => {
    //           this.findByProjectId()
    //           this.$notify.success({
    //             title: '成功',
    //             message: '保存成功'
    //           })
    //         })
    //         .catch(response => {
    //         })
    // },
    // resetForm(){
    //   this.dataForm = {
    //     projectId:this.projectId,
    //     overdueNumber:0,
    //     loanTotalAmount:0,
    //     loanAmount:0,
    //     loanRemainAmount:0,
    //     queryNumber:0,
    //     nearlySixUseAmount:0,
    //     nearlySixRepaymentAmount:0,
    //     creditTotalAmount:0,
    //     creditUseAmount:0,
    //     abnormalSituation:'',
    //   }
    // }
  }
}
</script>

<style scoped>

.item_margin{
  /* margin-left: 260px; */
}

</style>

